﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Fetal Cardiac Z-Score Calculator</title>

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
    <script src="Fetal04.js" type="text/javascript"></script>
    <script src="ZUtils.js" type="text/javascript"></script>    
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript">

            $(document).ready(function() {
                fetal.ega = $('#Weeksddl option:selected').val(); //sets the inital ega
                $("select").change(function() {
                    fetal.ega = ($('#Weeksddl option:selected').val() * 1 + ($('#Daysddl option:selected').val() * 1 / 7)).toFixed(1) * 1;
                    $("#LMP").html(fetal.lmp());
                    $("#EDD").html(fetal.edd());
                    $("input").change();
                });
            });
    </script>
    <script type="text/javascript">
        function CalculateZScores(site, score, selector) {
            if (!isNaN(score) && score != "" ) {
                var zselector = '#' + selector + 'Z';
                var z = site.zscore(score)
                $(zselector).html(z)
                .removeClass()
                .addClass(ZscoreFlag(z))
                .attr("title", calcPercentile(z) + " percentile");
                var mselector = '#' + selector + 'Mean';
                $(mselector).html(site.valueOf(0));
                var rselector = '#' + selector + 'Range';
                $(rselector).html(site.valueOf(-1.65) + " - " + site.valueOf(1.65));
            }
        }
    
    
    </script>

</head>
<body>
<div class="myGadget">
<div>
<label for="Weeksddl">Select EGA weeks and days: </label>
<select id="Weeksddl" >
    <option value="15">15 weeks</option>
    <option value="16">16 weeks</option>
    <option value="17">17 weeks</option>
    <option value="18" selected="selected">18 weeks</option>
    <option value="19">19 weeks</option>
    <option value="20">20 weeks</option>
    <option value="21">21 weeks</option>
    <option value="22">22 weeks</option>
    <option value="23">23 weeks</option>
    <option value="24">24 weeks</option>
    <option value="25">25 weeks</option>
    <option value="26">26 weeks</option>
    <option value="27">27 weeks</option>
    <option value="28">28 weeks</option>
    <option value="29">29 weeks</option>
    <option value="30">30 weeks</option>
    <option value="31">31 weeks</option>
    <option value="32">32 weeks</option>
    <option value="33">33 weeks</option>
    <option value="34">34 weeks</option>
    <option value="35">35 weeks</option>
    <option value="36">36 weeks</option>
    <option value="37">37 weeks</option>
    <option value="38">38 weeks</option>
    <option value="39">39 weeks</option>
    <option value="40">40 weeks</option>
</select>
<select id="Daysddl"  >
    <option value="0" selected="selected">0 days</option>
    <option value="1">1 day</option>
    <option value="2">2 days</option>
    <option value="3">3 days</option>
    <option value="4">4 days</option>
    <option value="5">5 days</option>
    <option value="6">6 days</option>

</select>
</div>
<div>Based on today's date and the given EGA: </div>
<div>The LMP is <span id="LMP" class="strong">...</span></div>
<div>The EDD is <span id="EDD" class="strong">...</span></div>
<div>
<table summary="Fetal Echo Z-Scores">

<tr>
<th>Site</th>

<th>Measured</th>

<th>Mean</th>

<th>Range</th>

<th>Z-Score</th>
</tr>

<tr>
<th colspan="2">Left Heart (cm)</th>
</tr>

<tr>
<td class="label"><label for="txtMV">Mitral Valve:</label></td>

<td><input id="txtMV" type="text" onchange="CalculateZScores(fetal.mitral, this.value, 'MV')" /></td>

<td id="MVMean" class="results">&nbsp;</td>

<td id="MVRange" class="results">&nbsp;</td>

<td id="MVZ" class="results">&nbsp;</td>
</tr>

<tr>
<td class="label"><label for="txtLV1">LV Minor:</label></td>

<td><input id="txtLV1" type="text" onchange="CalculateZScores(fetal.lvminor, this.value, 'LV1')" /></td>

<td id="LV1Mean" class="results">&nbsp;</td>

<td id="LV1Range" class="results">&nbsp;</td>

<td id="LV1Z" class="results">&nbsp;</td>
</tr>

<tr>
<td class="label"><label for="txtLV2">LV Major:</label></td>

<td><input id="txtLV2" type="text" onchange="CalculateZScores(fetal.lvmajor, this.value, 'LV2')" /></td>

<td id="LV2Mean" class="results">&nbsp;</td>

<td id="LV2Range" class="results">&nbsp;</td>

<td id="LV2Z" class="results">&nbsp;</td>
</tr>

<tr>
<td class="label"><label for="txtAOV">Aortic Valve:</label></td>

<td><input id="txtAOV" type="text" onchange="CalculateZScores(fetal.aortic, this.value, 'AOV')" /></td>

<td id="AOVMean" class="results">&nbsp;</td>

<td id="AOVRange" class="results">&nbsp;</td>

<td id="AOVZ" class="results">&nbsp;</td>
</tr>

<tr>
<td class="label"><label for="txtAAO">AAO:</label></td>

<td><input id="txtAAO" type="text" onchange="CalculateZScores(fetal.aao, this.value, 'AAO')" /></td>

<td id="AAOMean" class="results">&nbsp;</td>

<td id="AAORange" class="results">&nbsp;</td>

<td id="AAOZ" class="results">&nbsp;</td>
</tr>

<tr>
<td class="label"><label for="txtDAO">DAO:</label></td>

<td><input id="txtDAO" type="text" onchange="CalculateZScores(fetal.dao, this.value, 'DAO')" /></td>

<td id="DAOMean" class="results">&nbsp;</td>

<td id="DAORange" class="results">&nbsp;</td>

<td id="DAOZ" class="results">&nbsp;</td>
</tr>

<tr>
<th colspan="2">Right Heart (cm)</th>
</tr>

<tr>
<td class="label"><label for="txtTV">Tricuspid Valve:</label></td>

<td><input id="txtTV" type="text" onchange="CalculateZScores(fetal.tricuspid, this.value, 'TV')" /></td>

<td id="TVMean" class="results">&nbsp;</td>

<td id="TVRange" class="results">&nbsp;</td>

<td id="TVZ" class="results">&nbsp;</td>
</tr>

<tr>
<td class="label"><label for="txtRV1">RV Minor:</label></td>

<td><input id="txtRV1" type="text" onchange="CalculateZScores(fetal.rvminor, this.value, 'RV1')" /></td>

<td id="RV1Mean" class="results">&nbsp;</td>

<td id="RV1Range" class="results">&nbsp;</td>

<td id="RV1Z" class="results">&nbsp;</td>
</tr>

<tr>
<td class="label"><label for="txtRV2">RV Major</label> :</td>

<td><input id="txtRV2" type="text" onchange="CalculateZScores(fetal.rvmajor, this.value, 'RV2')" /></td>

<td id="RV2Mean" class="results">&nbsp;</td>

<td id="RV2Range" class="results">&nbsp;</td>

<td id="RV2Z" class="results">&nbsp;</td>
</tr>

<tr>
<td class="label"><label for="txtPV">Pulmonary Valve:</label></td>

<td><input id="txtPV" type="text" onchange="CalculateZScores(fetal.pulmonary, this.value, 'PV')" /></td>

<td id="PVMean" class="results">&nbsp;</td>

<td id="PVRange" class="results">&nbsp;</td>

<td id="PVZ" class="results">&nbsp;</td>
</tr>

<tr>
<td class="label"><label for="txtMPA">MPA:</label></td>

<td><input id="txtMPA" type="text" onchange="CalculateZScores(fetal.mpa, this.value, 'MPA')" /></td>

<td id="MPAMean" class="results">&nbsp;</td>

<td id="MPARange" class="results">&nbsp;</td>

<td id="MPAZ" class="results">&nbsp;</td>
</tr>

<tr>
<td class="label"><label for="txtRPA">RPA:</label></td>

<td><input id="txtRPA" type="text" onchange="CalculateZScores(fetal.rpa, this.value, 'RPA')" /></td>

<td id="RPAMean" class="results">&nbsp;</td>

<td id="RPARange" class="results">&nbsp;</td>

<td id="RPAZ" class="results">&nbsp;</td>
</tr>

<tr>
<td class="label"><label for="txtLPA">LPA:</label></td>

<td><input id="txtLPA" type="text" onchange="CalculateZScores(fetal.lpa, this.value, 'LPA')" /></td>

<td id="LPAMean" class="results">&nbsp;</td>

<td id="LPARange" class="results">&nbsp;</td>

<td id="LPAZ" class="results">&nbsp;</td>
</tr>

<tr>
<th colspan="2">Isthmus &amp; Duct (mm)</th>
</tr>

<tr>
<td class="label"><label for="txtIsthmus3">Isthmus, 3VV (mm):</label></td>

<td><input id="txtIsthmus3" type="text" onchange="CalculateZScores(fetal.isthmus3, this.value, 'Isthmus3')" /></td>

<td id="Isthmus3Mean" class="results">&nbsp;</td>

<td id="Isthmus3Range" class="results">&nbsp;</td>

<td id="Isthmus3Z" class="results">&nbsp;</td>
</tr>

<tr>
<td class="label"><label for="txtDuct3">Duct, 3VV (mm):</label></td>

<td><input id="txtDuct3" type="text" onchange="CalculateZScores(fetal.ductus, this.value, 'Duct3')" /></td>

<td id="Duct3Mean" class="results">&nbsp;</td>

<td id="Duct3Range" class="results">&nbsp;</td>

<td id="Duct3Z" class="results">&nbsp;</td>
</tr>

<tr>
<td class="label"><label for="txtIsthmus">Isthmus, Sagittal (mm):</label></td>

<td><input id="txtIsthmus" type="text" onchange="CalculateZScores(fetal.isthmus, this.value, 'Isthmus')" /></td>

<td id="IsthmusMean" class="results">&nbsp;</td>

<td id="IsthmusRange" class="results">&nbsp;</td>

<td id="IsthmusZ" class="results">&nbsp;</td>
</tr>

<tr>
<td>&nbsp;</td>

<td><input id="btnCalculateZ" type="button" value="Calculate !" onclick=
"CalculateZScores()" class="button" /></td>
</tr>
</table>
</div>
</div>
</body>
</html>
